package com.mocha.websocket.metadata;


/**
 * 进入 消息 类型
 */
public enum MochaMessageType {

    Text((byte) 0),
    Chat((byte)1),
    Binary((byte)2),
    SocketText((byte)3);

    private byte code;

    MochaMessageType(byte code){
        this.code = code;
    }

    public int code() {
        return this.code;
    }

    public static MochaMessageType codeOf(byte code){
        MochaMessageType[] vs = values();
        for (MochaMessageType t : vs){
            if (t.code == code){
                return t;
            }
        }
        return null;
    }

}
